<template>
  <view>
    <up-tabbar :value="props.index" :fixed="true" :placeholder="false" activeColor="#d81e06">
      <up-tabbar-item
        :text="item.text"
        :icon="item.icon"
        @click="tabbarChange(index)"
        v-for="(item, index) in tabbarList"
        :key="index"
      ></up-tabbar-item>
    </up-tabbar>
  </view>
</template>

<script setup>
import { ref, onMounted } from 'vue'
// 定义组件属性
const props = defineProps({
  index: {
    type: Number,
    default: 0
  }
})
const tabbarList = ref([
  { text: '购物', icon: 'home', path: '/pages/index/index' },
  { text: '分类', icon: 'photo', path: '/pages/category/index' },
  { text: '我的', icon: 'account', path: '/pagesMember/user/index' }
])
const tabbarChange = (index) => {
  uni.switchTab({
    url: tabbarList.value[index].path
  })
}
</script>

<style lang="scss" scoped></style>
